abstract class Data{
    abstract public void DisplayValue();
}
class Integer extends Data {
    int value;
    Integer(){
        value=100;
    }
    public void DisplayValue(){
        System.out.println(value);
    }
}
class Long extends Data {
    int value;
    Long(){
        value=11271013;
    }
    public void DisplayValue(){
        System.out.println(value);
    }
}
abstract class Factory {
    abstract public Data CreateDataObject();
}
class IntFactory extends Factory {
    public Data CreateDataObject(){
        return new Integer();
    }
}
class LongFactory extends Factory {
    public Data CreateDataObject(){
        return new Long();
    }
}
class Document {
    Data pd;
    Document(Factory pf){
        pd = pf.CreateDataObject();
    }
    public void DisplayData(){
        pd.DisplayValue();
    }
}
public class MyDoc{
    static Document d;
    public static void main(String [] args) {
        d = new Document(new IntFactory());
        d = new Document(new LongFactory());
        d.DisplayData();
    }
}